using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace Terra.Data.Models.Identity;

/// <summary>
/// 角色基础DTO
/// </summary>
public class RoleBaseDto
{
    /// <summary>
    /// 角色名称
    /// </summary>
    [Required(ErrorMessage = "角色名称不能为空")]
    [StringLength(50, ErrorMessage = "角色名称长度不能超过50个字符")]
    public string Name { get; set; }

    /// <summary>
    /// 描述
    /// </summary>
    [StringLength(200, ErrorMessage = "描述长度不能超过200个字符")]
    public string Description { get; set; }

    /// <summary>
    /// 是否系统角色
    /// </summary>
    public bool IsSystem { get; set; } = false;

    /// <summary>
    /// 权限ID列表
    /// </summary>
    public List<Guid> PermissionIds { get; set; } = new List<Guid>();
}

/// <summary>
/// 角色查询DTO
/// </summary>
public class RoleQueryDto
{
    /// <summary>
    /// 角色名称
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// 是否系统角色
    /// </summary>
    public bool? IsSystem { get; set; }

    /// <summary>
    /// 页码
    /// </summary>
    public int PageIndex { get; set; } = 1;

    /// <summary>
    /// 每页记录数
    /// </summary>
    public int PageSize { get; set; } = 10;
}

/// <summary>
/// 角色创建DTO
/// </summary>
public class RoleCreateDto : RoleBaseDto
{

}

/// <summary>
/// 角色更新DTO
/// </summary>
public class RoleUpdateDto : RoleBaseDto
{
    /// <summary>
    /// 角色ID
    /// </summary>
    [Required(ErrorMessage = "角色ID不能为空")]
    public Guid Id { get; set; }


    /// <summary>
    /// 并发标记
    /// </summary>
    public string ConcurrencyStamp { get; set; }

}

/// <summary>
/// 角色详情DTO
/// </summary>
public class RoleDetailDto : RoleBaseDto
{
    /// <summary>
    /// 角色ID
    /// </summary>
    public Guid Id { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreatedTime { get; set; }

    /// <summary>
    /// 最后修改时间
    /// </summary>
    public DateTime? LastModifiedTime { get; set; }

    /// <summary>
    /// 并发标记
    /// </summary>
    public string ConcurrencyStamp { get; set; }

}

/// <summary>
/// 角色列表项DTO
/// </summary>
public class RoleItemDto : RoleBaseDto
{
    /// <summary>
    /// 角色ID
    /// </summary>
    public Guid Id { get; set; }


    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreatedTime { get; set; }
}

/// <summary>
/// 角色选择DTO
/// </summary>
public class RoleSelectDto
{
    /// <summary>
    /// 角色ID
    /// </summary>
    public Guid Id { get; set; }

    /// <summary>
    /// 角色名称
    /// </summary>
    public string Name { get; set; }
}

/// <summary>
/// 角色用户分配DTO
/// </summary>
public class RoleAssignUsersDto
{
    /// <summary>
    /// 角色ID
    /// </summary>
    [Required(ErrorMessage = "角色ID不能为空")]
    public Guid RoleId { get; set; }

    /// <summary>
    /// 用户ID列表
    /// </summary>
    [Required(ErrorMessage = "用户ID列表不能为空")]
    public List<Guid> UserIds { get; set; }
}

/// <summary>
/// 角色批量删除DTO
/// </summary>
public class RoleBatchDeleteDto
{
    /// <summary>
    /// 角色ID列表
    /// </summary>
    [Required(ErrorMessage = "角色ID列表不能为空")]
    public List<Guid> RoleIds { get; set; }
}
